var app = new Vue({
    el:"#player",
    data:{
        query:"",
        musicList:[],
        musicUrl:"",
        picCovel:"",
        hotComments:[ ],
        isPlaying:false ,
        isShow:false,
        mvUrl:"",
    }, 
    methods: {
        searchMusic:function(){
            var that = this;
            axios.get("https://autumnfish.cn/search?keywords="+this.query)
            .then(function (response) {
                // console.log(response);
                that.musicList = response.data.result.songs;
            })
            .catch(function (error) {
            })
        },
        playMusic:function(musicId){
            //console.log(musicId);
            var that = this;
            axios.get("https://autumnfish.cn/song/url?id="+musicId)
            .then(function (response) {
                // console.log(response);
                that.musicUrl = response.data.data[0].url;
            })
            .catch(function (error) {
            })
            axios.get("https://autumnfish.cn/song/detail?ids="+musicId)
            .then(function (response) {              
                that.picCovel = response.data.songs[0].al.picUrl;
            })
            .catch(function (error) {
            })
            axios.get("https://autumnfish.cn/comment/hot?type=0&id="+musicId)
            .then(function (response) {              
                that.hotComments = response.data.hotComments;
            })
            .catch(function (error) {
            })
        },
        play:function(){
            // console.log("play");
            this.isPlaying=true;
        },
        pause:function(){
            // console.log("pause");
            this.isPlaying=false;
        },
        playMV:function(mvid){
            var that = this;
            axios.get("https://autumnfish.cn/mv/url?id="+mvid)
            .then(function (response) { 
                that.isShow = true;             
                that.mvUrl = response.data.data.url;
            })
            .catch(function (error) {
            })
        },
        hide:function(){
            this.isShow=false;
        }
    },
})